new Vue({
    el: '#login',
    data () {
        return {
            dialogFormVisible: false,
            isLogin:false,
            user: {
                studentId: 2019214378,
                password: '2019214378',
            },
            formLabelWidth: '120px',
            rules: {
               account: [
                    { required: true, message: '请输账号', trigger: 'blur' },
                    { min: 10, max: 11, message: '请检查账号正确性', trigger: 'blur' }
                ]
            }
        }
    },

    methods: {
        handleClose () {
            this.$refs.ruleForm.resetFields()
            this.user = {
                account: '',
                password: '',
            }
        },
        login() {console.log(this.user)
            let that=this
            axios.post('/service_stu/student/login', this.user).then(res => {
                console.log(res.data)
                if (res.data.code==10000) {
                    that.isLogin=true
                    that.student=res.data.data.student
                    window.location.href = 'http://localhost:8001/login_success';
                } else {
                    this.$message({
                        type: 'info',
                        message: '密码错误'
                    });
                }
            }).catch(function (error) { // 请求失败处理
                console.log(error);
            });
        },
    }

})